module windump.scanning.detector;

public import windump.scanning.common;
import windump.scanning.scanner;

// 各种 Detector 的基类，只要继承了这个类就会自动被注册，当然了，其必须在同一个程序中
class Detector(Subclass, string NodeName, string ResultType) : IDetector
{
    public abstract ResultItem[] update();

	public override string name() {
		return NodeName;
	}

	public override string className() {
		return Subclass.classinfo.name;
	}

	public override string type() {
		return ResultType;
	}

	public static this()
	{
		//不要把异常传播出去
        //TODO: 到底该怎么处理初始化插件的异常？
		try {
			Scanner.instance.registerDetector(NodeName, new Subclass);
		}
		catch(Exception e)
		{
		}
	}
}
